package com.mt.mtbusinessmanagementsystem.utils.product.level;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Builder
@Repository
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class FirstLevel implements ProductClassLevel{
    private Integer firstClassificationId;
    private String firstClassificationName;
    private List<SecondLevel> dataList;

    public static FirstLevel fromProductClassLevel(ProductClassLevel productClassLevel) {
        if (productClassLevel instanceof FirstLevel) {
            return (FirstLevel) productClassLevel;
        } else {
            throw new IllegalArgumentException("不能转换为FirstLevel类");
        }
    }


}
